<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%
	request.setAttribute("title", "实验详情");
	request.setAttribute("modelConfigPath", "experiment");
%>

<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/uploaders/uploaders.jsp"%>
<style type="text/css">
</style>

<t:panel cssClass="panel-flat form-detailed" customBody="true"
	customHead="true">
	<div class="detailed-navbar-content panel-body">
		
		<t:form commandName="experiment" action="/admin/experiment/save"
			method="post" cssClass="form-horizontal">
			<div class="hide">
				<t:hidden path="experimentId" />
				<!-- <t:hidden path="projectId" /> -->
			</div>
			<t:formgroup>
				<t:label path="experimentName" cssClass="col-sm-2" />
				<t:input path="experimentName" colClass="col-sm-4" />
				<t:label path="projectId" cssClass="col-sm-2" />
				<t:select2 path="projectId" placeholder="选择项目" allowClear="true" colClass="col-sm-4" />
			</t:formgroup>
			<t:formgroup>
			<t:label path="experimentDate" cssClass="col-sm-2" />
				<t:date path="experimentDate"
					rightInputGroupIcon="icon-calendar52 text-primary"
					colClass="col-sm-4" />
				<t:label path="experimentAddress" cssClass="col-sm-2" />
				<t:input path="experimentAddress" colClass="col-sm-4" />
			</t:formgroup>
			<t:formgroup>
				<t:label path="employeeName" cssClass = "col-sm-2"/>
				<t:input path="employeeName" colClass = "col-sm-4" readonly="true" />
				<t:label path="employeeIds" cssClass="col-sm-2" />
				<t:select2 path="employeeIds" multiple="true" colClass="col-sm-4" />
			</t:formgroup>
			<t:formgroup>
				<t:label path="experimentReportName" cssClass = "col-sm-2"/>
				<t:input path="experimentReportName" colClass = "col-sm-8"/>
				<t:input  path="experimentReportUUID" style="display:none" readonly="false"/>
				<t:button onclick = "startUpload()" cssClass="btn-info">上传</t:button>
			</t:formgroup>
			<t:formgroup>
				<t:label path="experimentComment" cssClass="col-sm-2" />
				<t:textarea path="experimentComment" rows="6" colClass="col-sm-10" />
			</t:formgroup>
		</t:form>
	</div>
	<t:panelFoot headingBtnCssClass="heading-btn pull-right-important">
		<t:button icon="icon-floppy-disk" onclick="saveData()"
			cssClass="btn-info" csize="sm">保存</t:button>
	</t:panelFoot>
</t:panel>

<script type="text/javascript">
	function saveData() {
		if (!$("form:first").valid()) {
			return;
		}
		$("form:first").submit();
	}
	function startUpload(){
		$(document).startOssFileUpload({
			FileUploaded:function(up, file, info){
				fileUploader(up,file,info);
			}
		})
	}
	
	function fileUploader(up,file,info){
		if(info.status!=200){
			return;
		}
		var responseJson=JSON.parse(info.response)
		if(responseJson.Status!="OK"){
			return;
		}
		var ossId=responseJson.id;
		var showName=file.name;
		$("#experimentReportUUID").val(ossId);
		$("#experimentReportName").val(showName);
	}
</script>
<%@ include file="/WEB-INF/views/shared/base/scripts/jqueryui.jsp"%>
<%@ include
	file="/WEB-INF/views/shared/base/scripts/limitless/default/formselects.jsp"%>
<%@ include
	file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formpickers.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/dialog.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/contentFooter.jsp"%>
